﻿using UnityEngine;
using System.Collections;

namespace QFramework.Pacman
{
	/// <summary>
	/// 点
	/// </summary>
	public class Pacdot : MonoBehaviour
	{

		void OnTriggerEnter2D(Collider2D other)
		{
			if (other.name == "pacman")
			{
				var model = PacmanGame.Container.Resolve<PacmanModel>();
				model.Score.Value += 10;
				GameObject[] pacdots = GameObject.FindGameObjectsWithTag("pacdot");
				Destroy(gameObject);

				if (pacdots.Length == 1)
				{
					GameObject.FindObjectOfType<GameGUINavigation>().LoadLevel();
				}
			}
		}
	}
}